home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / comm / net / tf02.lha / TinyFugue / tf-lib / world-q.tf < prev   
Text File  |  1995-08-12  |  2KB  |  53 lines

  1. ;;;; Active worlds
  2. ;;; If you like to connect to a lot of worlds at the same time, you may find
  3. ;;; these macros useful.
  4.  
  5. ;;; Whenever activity occurs in a background world, these macros will add
  6. ;;; the name of that world to a queue.  Then, when you type ``ESC w'', they
  7. ;;; will switch to to the first world on the queue.  So by typing ``ESC w''
  8. ;;; repeatedly, you can visit all your active worlds.  If the queue is
  9. ;;; empty, ``ESC w'' will switch you to the last world you visited.
  10.  
  11. /~loaded worldqueue.tf
  12.  
  13. /require stack-q.tf
  14. /require lisp.tf
  15.  
  16. /def -ib'^[w' = /to_active_or_prev_world
  17.  
  18. /def -iFp1 -h"ACTIVITY" activity_queue_hook = \
  19.     /enqueue %1 active_worlds
  20.  
  21. ; don't queue world "rwho".
  22. /def -ip2 -msimple -h"ACTIVITY rwho" activity_rwho_hook
  23.  
  24. /def -iFp1 -h"WORLD" prev_world_hook =\
  25.     /set prev_world=%{fg_world}%;\
  26.     /set fg_world=${world_name}%;\
  27.     /set active_worlds=$(/remove %{fg_world} %{active_worlds})
  28.  
  29. ; don't remember world "rwho".
  30. /def -ip2 -msimple -h"WORLD rwho" prev_rwho_hook
  31.  
  32. /def -i to_active_world = \
  33.     /if ( active_worlds =~ "" ) \
  34.         /echo %% No active worlds.%;\
  35.     /else \
  36.         /fg $(/dequeue active_worlds)%;\
  37.     /endif
  38.  
  39. /def -i to_active_or_prev_world = \
  40.     /if ( active_worlds !~ "" ) \
  41.         /fg $(/dequeue active_worlds)%;\
  42.     /elseif ( prev_world !~ "" ) \
  43.         /fg -s %{prev_world}%;\
  44.     /endif
  45.  
  46. /def -i list_active_worlds = \
  47.     /if ( active_worlds =~ "" ) \
  48.         /echo %% No active worlds.%;\
  49.     /else \
  50.         /echo %% Active worlds:  %{active_worlds}%;\
  51.     /endif
  52.  
  53.